﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using DDD.Core;

using FloatComparer = DDDTest.Helper.FloatComparer;

namespace DDDTest.Core {
    [TestClass]
    public class TestCompositeMode {

        /// <summary>
        /// 
        /// </summary>
        /// <remarks>
        /// (*1) 現在の実装ではカラーバッファーの最大は決めうちで４になっている。
        /// </remarks>
        [TestMethod]
        public void Test_New1 () {
            var cmode = new CompositeMode ();

            Assert.AreEqual (true, cmode.IsDepthTestEnabled);
            Assert.AreEqual (DepthComparisonFunction.LessEqual, cmode.DepthComparisonFunction);

            Assert.AreEqual (0xffffffff, cmode.ColorWriteMask);
            Assert.AreEqual (ColorBlendFunction.Replace, cmode.ColorBlendFunction);
        }

        [TestMethod]
        public void Test_SetDepthTestEnabled () {
            var cmode = new CompositeMode ();
            cmode.SetDepthTestEnable (false);

            Assert.AreEqual (false, cmode.IsDepthTestEnabled);
        }

        [TestMethod]
        public void Test_SetDepthWriteMask () {
            var cmode = new CompositeMode ();
            cmode.SetDepthMask (0x12345678);

            Assert.AreEqual (0x12345678u, cmode.DepthWriteMask);
        }

        [TestMethod]
        public void Test_SetDepthTestFunction () {
            var cmode = new CompositeMode ();
            cmode.SetDepthComparisonFunction (DepthComparisonFunction.GreaterEqual);

            Assert.AreEqual (DepthComparisonFunction.GreaterEqual, cmode.DepthComparisonFunction);
        }

        [TestMethod]
        public void Test_SetColorWriteMask () {
            var cmode = new CompositeMode ();


            cmode.SetColorMask (0x01234567u);
            Assert.AreEqual (0x01234567u, cmode.ColorWriteMask);
        }

        [TestMethod]
        public void Test_SetColorBlendFunction () {
            var cmode = new CompositeMode ();

            cmode.SetColorBlendFunction (ColorBlendFunction.Modulate);
            Assert.AreEqual (ColorBlendFunction.Modulate, cmode.ColorBlendFunction);
        }

    }
}
